#pragma once

#include <string>

#include <net/instaweb/htmlparse/public/html_parse.h>
using namespace net_instaweb;

#include "Config.h"

class CParser
{
  std::auto_ptr<MessageHandler> m_message_handler;
  std::auto_ptr<HtmlParse> m_html_parser;  
public:  
  CParser(const std::string url, const std::string id);

  static void Expose(void);

  HtmlParse *GetParse(void) const { return m_html_parser.get(); }

  const std::string GetUrl(void) const { return m_html_parser->url(); }
  const std::string GetId(void) const { return m_html_parser->id(); }
  int GetLineNumber(void) const { return m_html_parser->line_number(); }

  void Reset(void);

  void Feed(const std::string& data) { m_html_parser->ParseText(data); }

  void Close(void) { m_html_parser->FinishParse(); }

  void Flush(void) { m_html_parser->Flush(); }
};
